package com.gongj.event;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Service;

@Service
public class UserService {

	@Autowired
	private ApplicationContext applicationContext;

	@Autowired
	ApplicationEventPublisher applicationEventPublisher;

	public void login(){

		System.out.println("登录成功");
		// 发布事件
		applicationEventPublisher.publishEvent(new SendEvent(this,"cxyxj"));
		applicationEventPublisher.publishEvent(new KTVEvent(this));
		System.out.println("方法结束");
	}
}
